
#include "GNS_Handler.h"

#define WHITE_BG "box1.png"
#define TOUMING_BG "box2.png"

CustomEditBox* GNS_Handler::createEditBoxWithExistFeild(TextField* textField,
	Node* parent,
	int maxLen,
	EditBox::InputMode inputMode,
	bool noChinese,
	EditBox::InputFlag inputFlag)
{
	CustomEditBox* pRe = CustomEditBox::create(textField->getSize(), WHITE_BG);
	pRe->setPosition(textField->getPosition());
	pRe->setFontName(textField->getFontName().c_str());
	pRe->setText(textField->getString().c_str());
	pRe->setFontColor(textField->getColor());
	pRe->setPlaceHolder(textField->getPlaceHolder().c_str());
	pRe->setPlaceholderFontName(textField->getFontName().c_str());
	pRe->setFontSize(textField->getFontSize());
	pRe->setPlaceholderFontSize(textField->getFontSize());
	pRe->setPlaceholderFontColor(textField->getPlaceHolderColor());
	pRe->setPlaceholderFontColor(Color4B::BLACK);
	pRe->setMaxLength(maxLen);
	pRe->setInputMode(inputMode);
	pRe->setInputFlag(inputFlag);
	pRe->setCheckCNInput(noChinese);
	parent->addChild(pRe);

	textField->setVisible(false);
	return pRe;
}

CustomEditBox* GNS_Handler::createTMEditBoxWithExistFeild(TextField* textField,
	Node* parent,
	int maxLen,
	EditBox::InputMode inputMode,
	bool noChinese,
	EditBox::InputFlag inputFlag)
{
	CustomEditBox* pRe = CustomEditBox::create(textField->getSize(), TOUMING_BG);
	pRe->setPosition(textField->getPosition());
	pRe->setFontName(textField->getFontName().c_str());
	pRe->setText(textField->getString().c_str());
	pRe->setFontColor(textField->getColor());
	pRe->setPlaceHolder(textField->getPlaceHolder().c_str());
	pRe->setPlaceholderFontName(textField->getFontName().c_str());
	pRe->setFontSize(textField->getFontSize());
	pRe->setPlaceholderFontSize(textField->getFontSize());
	pRe->setPlaceholderFontColor(textField->getPlaceHolderColor());
	pRe->setPlaceholderFontColor(Color4B::BLACK);
	pRe->setMaxLength(maxLen);
	pRe->setInputMode(inputMode);
	pRe->setInputFlag(inputFlag);
	pRe->setCheckCNInput(noChinese);
	parent->addChild(pRe);

	textField->setVisible(false);
	return pRe;
}